package edu.sctu.zhuyingzhi.month201506.day20150608.timerV3;

import java.util.Scanner;


/**
 * Created by user13 on 2015/6/8.
 */
public class Controller implements Runnable{
    int i;
    private boolean j = true;

    @Override
    public void run() {
        TimerThread timerThread = new TimerThread();

        System.out.println("请输入1开始计时");
        System.out.println("请输入2暂停计时");
        System.out.println("请输入3记录时间");
        System.out.println("请输入4退出计时");

        int x;
        Scanner in = new Scanner(System.in);
        while(j) {
            x = Integer.parseInt(in.next());
            switch (x) {
                case 1:
                    timerThread.startTimer();
                    break;
                case 2:
                    timerThread.pause();
                    break;
                case 3:
                    timerThread.read();
                    break;
                case 4:
                    timerThread.stop();
                    break;
            }
        }
    }
}
